﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace WebApplicationPruebaMultilenguaje
{
    public partial class SiteMaster : System.Web.UI.MasterPage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
                CargarComboIdiomas();
        }


        protected void ddlLenguaje_SelectedIndexChanged(object sender, EventArgs e)
        {
            DropDownList senderDdl = sender as DropDownList;

            Session["IdiomaSeleccionado"] = senderDdl.SelectedValue;
            Response.Redirect(Request.Path);
            //Server.Transfer(Request.Path);

        }

        private void CargarComboIdiomas()
        {

            ListItem item1 = new ListItem();
            item1.Text = "Español";
            item1.Value = "es-UY";
            ddlLenguaje.Items.Add(item1);

            ListItem item2 = new ListItem();
            item2.Text = "Ingles";
            item2.Value = "en-US";
            ddlLenguaje.Items.Add(item2);

            ListItem item3 = new ListItem();
            item3.Text = "Portugues";
            item3.Value = "pt-BR";
            ddlLenguaje.Items.Add(item3);
        }
    }
}
